package com.eight.cloud.mybatisflex.config;

import com.eight.cloud.mybatisflex.entity.BaseEntity;
import com.eight.cloud.mybatisflex.listener.GlobalInsertListener;
import com.eight.cloud.mybatisflex.listener.GlobalUpdateListener;
import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.dialect.DbType;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: MybatisFlexConfig
 * @Author: TXC
 * @Date: 2025-09-15 16:53
 **/
@Configuration
public class MybatisFlexConfig {
    public MybatisFlexConfig() {
        FlexGlobalConfig config = FlexGlobalConfig.getDefaultConfig();
        config.registerInsertListener(new GlobalInsertListener(), BaseEntity.class);
        config.registerUpdateListener(new GlobalUpdateListener(), BaseEntity.class);
        config.setDbType(DbType.MYSQL);
    }
}
